// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported AuthPrompt */
-const { Clutter, Gdm, Gio, GObject, Pango, Shell, St } = imports.gi;
+const { Clutter, GObject, Pango, Shell, St } = imports.gi;
const Animation = imports.ui.animation;
const Batch = imports.gdm.batch;
y_align: Clutter.ActorAlign.CENTER,
child: new St.Icon({ icon_name: 'go-previous-symbolic' }),
});
- this.cancelButton.connect('clicked', () => this._onCancelButtonClicked());
+ this.cancelButton.connect('clicked', () => this.cancel());
this._mainBox.add_child(this.cancelButton);
let entryParams = {
});
}
- _onCancelButtonClicked() {
- if (this._mode == AuthPromptMode.UNLOCK_ONLY) {
- let screenSaverSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.screensaver' });
- if (screenSaverSettings.get_boolean('user-switch-enabled'))
- Gdm.goto_login_session_sync(null);
- }
- this.cancel();
- }
-
setMessage(message, type) {
if (type == GdmUtil.MessageType.ERROR)
this._message.add_style_class_name('login-dialog-message-warning');
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported UnlockDialog */
-const { AccountsService, Atk, Clutter, Gdm,
+const { AccountsService, Atk, Clutter, Gdm, Gio,
GnomeDesktop, GLib, GObject, Meta, Shell, St } = imports.gi;
const Background = imports.ui.background;
this._promptBox.add_child(this._authPrompt);
+ let screenSaverSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.screensaver' });
+ if (screenSaverSettings.get_boolean('user-switch-enabled')) {
+ let otherUserLabel = new St.Label({
+ text: _('Log in as another user'),
+ style_class: 'login-dialog-not-listed-label',
+ });
+ this._otherUserButton = new St.Button({
+ style_class: 'login-dialog-not-listed-button',
+ can_focus: true,
+ child: otherUserLabel,
+ reactive: true,
+ });
+ this._otherUserButton.connect('clicked', this._otherUserClicked.bind(this));
+ this._promptBox.add_child(this._otherUserButton);
+ } else {
+ this._otherUserButton = null;
+ }
+
this._authPrompt.reset();
this._updateSensitivity(true);
}
_maybeDestroyAuthPrompt() {
let focus = global.stage.key_focus;
if (focus === null ||
- (this._authPrompt && this._authPrompt.contains(focus)))
+ (this._authPrompt && this._authPrompt.contains(focus)) ||
+ (this._otherUserButton && focus === this._otherUserButton))
this.grab_key_focus();
if (this._authPrompt) {
this._authPrompt.destroy();
this._authPrompt = null;
}
+
+ if (this._otherUserButton) {
+ this._otherUserButton.destroy();
+ this._otherUserButton = null;
+ }
}
_updateSensitivity(sensitive) {
this._authPrompt.updateSensitivity(sensitive);
+
+ if (this._otherUserButton) {
+ this._otherUserButton.reactive = sensitive;
+ this._otherUserButton.can_focus = sensitive;
+ }
}
_showClock() {
});
}
+ _otherUserClicked() {
+ Gdm.goto_login_session_sync(null);
+
+ this._authPrompt.cancel();
+ }
+
_onDestroy() {
this.popModal();